<%--
  Created by IntelliJ IDEA.
  User: 15c
  Date: 2017/5/17
  Time: 14:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
  <title></title>
</head>
<body>
<%
  try {
    String url = request.getParameter("url");
    int pageSize = Integer.parseInt(request.getParameter("maxPageItems"));
    int items = Integer.parseInt(request.getParameter("items"));
    int totalPage = Integer.parseInt(request.getParameter("totalPage"));
    String keyword =new String (request.getParameter("keyword").getBytes("utf-8"));
%>

<pg:pager items="<%=items%>" maxPageItems="<%=pageSize%>" url="<%=url%>" maxIndexPages="10" export="curPage=pageNumber">
  共有<span style="color: red"><%=totalPage%></span>页 当前是第<span style="color: red"><%=curPage%></span>页
  <pg:param name="keyword" value="<%=keyword%>"/>
  <pg:first>
    <a href="${pageUrl}">首页</a>
  </pg:first>
  <pg:prev>
    <a href="${pageUrl}">上一页</a>
  </pg:prev>
  <pg:pages>
    <c:if test="${curPage eq  pageNumber}">
      [<span style="color: red;font-weight: bold"><%=pageNumber%></span>]
    </c:if>
    <c:if test="${curPage ne pageNumber}">
      <a href="${pageUrl}">${pageNumber}
      </a>
    </c:if>
  </pg:pages>
  <pg:next>
    <a href="${pageUrl}">下一页</a>
  </pg:next>
  <pg:last>
    <a href="${pageUrl}">尾页</a>
  </pg:last>
</pg:pager>
<%
  } catch (NumberFormatException e) {
    e.getMessage();
  }


%>

</body>
</html>
